package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.Goods;
import com.atguigu.jxc.service.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author fenge
 */
@Controller
@RequestMapping("goodsType")
public class GoodsTypeController {

    @Autowired
    private GoodsTypeService goodsTypeService;

    @PostMapping("loadGoodsType")
    @ResponseBody
    public String loadGoodsType(){
        return goodsTypeService.loadGoodsType();
    }

    @PostMapping("save")
    @ResponseBody
    public ServiceVO save(String goodsTypeName, Integer pId){
        goodsTypeService.save(goodsTypeName,pId);
        return new ServiceVO(100,"请求成功");
    }

    @PostMapping("delete")
    @ResponseBody
    public ServiceVO delete(Integer goodsTypeId){
        goodsTypeService.delete(goodsTypeId);
        return new ServiceVO(100,"请求成功");
    }


}
